//index.js
//获取应用实例
const http=require('../../models/http')
Page({
    data:{
        musics:[]
    },
    onLoad(){
        http.getCatData().then(res=>{
            var playlists=res.data.playlists
            var arr=[]
            playlists.forEach(item=>{
                var obj={};
                obj.name=item.name;
                obj.id=item.id;
                obj.cover=item.coverImgUrl;
                obj.playCount=item.playCount;
                arr.push(obj)
            })
            this.setData({
                musics:arr
            })
        })
    }
})
